package day_2022_9_to_12.Day;

import java.util.Arrays;

/**
 * @author haomin
 * @date 2022/09/12 00:00
 **/
public class Day9_5_Num300_LengthOfLIS {
    class Solution {
        public int lengthOfLIS(int[] nums) {
            int res = 0;
            int[] dp = new int[nums.length];
            Arrays.fill(dp, 1);
            for(int i = 0; i < nums.length; ++i){
                for(int j = 0; j < i; ++j){
                    if(nums[i] > nums[j]){
                        dp[i] = Math.max(dp[i], dp[j]+1);
                    }
                }
            }
            for (int i = 0; i < dp.length; i++) {
                res = Math.max(res, dp[i]);
            }
            return res;
        }
    }
}